<?php

namespace App\Admin\Forms;

use App\Models\Good;
use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Table;

class GoodsList extends LazyRenderable
{
	public function render()
	{
		// 获取ID
		$id = $this->goods_id;
		//dd($id);
		
		$data = Good::where('id', $id)
			->get()
			->toArray();
		$datas = [];
		foreach ($data as $k => $v) {
			//dump($data);
			$datas[$k]['id'] = $v['id'];
			$datas[$k]['goods_name'] = $v['goods_name'];
			$datas[$k]['goods_price'] = $v['goods_price'];
			$datas[$k]['goods_amount'] = $v['goods_amount'];
			$datas[$k]['goods_describe'] = $v['goods_describe'];
		}
		$titles = [
			'商品序号',
			'商品名称',
			'商品价格',
			'商品数量',
			'商品简介',
		];
		
		return Table::make($titles, $datas);
	}
	
	
}